A Functional Language For Generating Structured Text

نویسنده

  • Terence Parr
چکیده

This paper describes ST (StringTemplate), a domain-specific functional language for generating structured text from internal data structures that has the flavor of an output grammar. ST’s feature set is driven by solving real problems encountered in complicated systems such as ANTLR version 3’s retargetable code generator. Features include template group inheritance, template polymorphism, lazy evaluation, recursion, output auto-indentation, and the new notions of group interfaces and template regions. Experience shows that ST is easy to learn and satisfying to use. ST’s primary contribution is the clear identification and implementation of a tightly-bracketed solution to the problem of rendering data structures to text, as dictated by the nature of generation and the critical goal of strictly separating the generation logic from the output templates. First, the very nature of code generation suggests the use of a generational grammar. Next, enforcing separation of the generation logic from the output templates restricts the template language syntactically and semantically in such way that templates are easily shown to be equivalent to a grammar. Finally, the rules of separation, such as side-effect free expressions, coincide with the fundamentals of pure, functional programming.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Systemic Functional Linguistics as a Tool of Text Analysis for Translation

Translation, ipso facto, is an understanding and a transferal of meaning from one language into another. Therefore, it may be fitting to conclude that a suitable semantic theory should underpin any attempt to that end. This paper advocates implementing Systemic Functional Linguistics (henceforth SFL) which subscribes to a view of language as a "meaning-potential". In fact, Halliday and Matthies...

متن کامل

Presenting a method for extracting structured domain-dependent information from Farsi Web pages

Extracting structured information about entities from web texts is an important task in web mining, natural language processing, and information extraction. Information extraction is useful in many applications including search engines, question-answering systems, recommender systems, machine translation, etc. An information extraction system aims to identify the entities from the text and extr...

متن کامل

GNU TeXmacs : A free , structured , wysiwyg and technical text

There is a common belief that wysiwyg technical editors are not suited for editing structured texts and generating documents with a high typographical quality. In this paper, we analyze the reasons behind this belief. We next discuss the program GNU TEXmacs and some of its innovations in relation to the difficulties of structured, wysiwyg, technical text editing.

متن کامل

Strictly Pretty

Pretty printers are tools for formatting structured text. A recently taken algebraic approach has lead to a systematic design of pretty printers. Wadler has proposed such an algebraic pretty printer together with an implementation for the lazy functional language Haskell. The original design causes exponential complexity when literally used in a strict language. This note recalls some propertie...

متن کامل

Generating Visual Editors for Formally Specified Languages

We discuss the generation of structured visual editors for formally speciied languages. We use the term structured visual editor to refer to a structure{oriented editor which provides language speciic behavior and supports the interactive construction of programs. This paper describes how such a visual editor can be generated from a formal language speciication including the language's visual s...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2006